﻿using System.Drawing;
using System.Windows.Forms;
using CloudShot.Core.Interfaces;
using CloudShot.Entities;
using CloudShot.Forms;
using CloudShot.Interfaces;
using CloudShot.Logic;

namespace CloudShot.Capturers
{
  internal sealed class RecordCapturer : ShotCapturer, ICapturer
  {
    public RecordCapturer(StorageContainer storageContainer, INotificationService notificationService, Color fillColor, IConfigurationSection appConfiguration)
      : base(storageContainer, appConfiguration, notificationService, false, false, fillColor, true)
    {
    }

    protected override Image GetImage(CaptureResult captureResult)
    {
      using (var captureForm = new RecordCaptureForm(captureResult.Location, captureResult.Image.Size, AppConfigurationSection, NotificationService, StorageContainer))
      {
        return captureForm.ShowDialog() == DialogResult.OK ? captureForm.Image : null;  
      }      
    }
  }
}